package main

import (
	"fmt"
	"strconv"
	"time"
)

//协程一般是用函数开启的
func PrintHello(){
	for i:=0;i<100;i++ {
		fmt.Println("test()",strconv.Itoa(i))
		time.Sleep(time.Second)
	}
}

func main()  {

	go PrintHello()  //开启一个协程

	for i:=0;i<10;i++ {
		fmt.Println("main()",strconv.Itoa(i))
		time.Sleep(time.Second)
	}
}
